package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.model.BalanceDiff;
import com.ygqh.baby.model.YgCommissionOrderModel;
import com.ygqh.baby.model.YgUserBalanceOrderModel;
import com.ygqh.baby.model.YgUserShareOrderModel;
import com.ygqh.baby.po.YgOrder;
import com.ygqh.baby.po.YgUser;
import com.ygqh.baby.po.YgUserBalance;
import com.ygqh.baby.po.YgUserBalanceExample;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface YgUserBalanceMapper {
	int countByExample(YgUserBalanceExample example);

	int deleteByExample(YgUserBalanceExample example);

	int deleteByPrimaryKey(Long id);

	int insert(YgUserBalance record);

	int insertSelective(YgUserBalance record);

	List<YgUserBalance> selectByExample(YgUserBalanceExample example);

	YgUserBalance selectByPrimaryKey(Long id);

	int updateByExampleSelective(@Param("record") YgUserBalance record, @Param("example") YgUserBalanceExample example);

	int updateByExample(@Param("record") YgUserBalance record, @Param("example") YgUserBalanceExample example);

	int updateByPrimaryKeySelective(YgUserBalance record);

	int updateByPrimaryKey(YgUserBalance record);

	List<YgUser> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("userName") String userName,
							 @Param("sourceCode") String sourceCode, @Param("q") String q,
							 @Param("startTime") Date startTime, @Param("endTime") Date endTime,
							 @Param("userType") String userType, @Param("userId") Long userId);

	int countSuper(@Param("userName") String userName, @Param("sourceCode") String sourceCode, @Param("q") String q,
				   @Param("startTime") Date startTime, @Param("endTime") Date endTime,
				   @Param("userType") String userType, @Param("userId") Long userId);

	List<YgUserBalanceOrderModel> selectOrderList(@Param("queryInfo") QueryInfo queryInfo, @Param("sourceCode") String sourceCode);

	int updateUserBalanceByTask(@Param("balanceList") List<YgUserBalance> balanceList);

	int updateUserBalancePrice(@Param("balanceList") List<YgUserBalance> balanceList);

	List<YgUserBalance> findListByUserIds(@Param("userIds") List<Long> userIds);

	int reduceAcountPrice(@Param("userId") Long userId, @Param("accountPrice") BigDecimal accountPrice,
						  @Param("platformNo") String platformNo);

	int backAcountPrice(@Param("userId") Long userId, @Param("accountPrice") BigDecimal accountPrice,
						@Param("platformNo") String platformNo);

	int backAcountPriceBatch(@Param("orderList") List<YgOrder> orderList);

	List<BalanceDiff> selectDifference(@Param("bType") String bType, @Param("splitPlatform") boolean splitPlatform);

	int resetUserBalance(@Param("bType") String bType, @Param("userIds") List<Long> userIds,
						 @Param("splitPlatform") boolean splitPlatform);

	YgCommissionOrderModel getUserShareOrderPrice(@Param("sourceCode") String sourceCode, @Param("groupTag") String groupTag,
			@Param("startDate") Date startDate, @Param("endDate") Date endDate);

	List<YgUserShareOrderModel> getUserShareOrder(@Param("queryInfo") QueryInfo queryInfo, @Param("sourceCode") String sourceCode,
			@Param("groupTag") String groupTag, @Param("startDate") Date startDate, @Param("endDate") Date endDate);

}